import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path:"/",
    redirect:"/home"
  },
  //首页
  {
    path: '/home',
    name: 'home',
    component: HomeView
  },
  //手记
  {
    path:"/NoteFun",
    name:'NoteFun',
    //路由懒加载
    component:()=>import("../views/NoteFun.vue")
  },
  //搜索1
  {
    path:"/SearchFun",
    name:'SearchFun',
    //路由懒加载
    component:()=>import("../views/SearchFun.vue")
  },
  //搜索界面2
  {
    path:"/SearchTwo",
    name:'SearchTwo',
    //路由懒加载
    component:()=>import("../views/SearchTwo.vue")
  },
  //搜索界面3
  {
    path:"/SearchThree",
    name:'SearchThree',
    //路由懒加载
    component:()=>import("../views/SearchThree.vue")
  },
  //视频播放界面
  {
    path:"/VideoDisplay",
    name:'VideoDisplay',
    //路由懒加载
    component:()=>import("../views/VideoDisplay.vue")
  },
  //创作人页面
  {
    path:"/ComposerFun",
    name:'ComposerFun',
    //路由懒加载
    component:()=>import("../views/ComposerFun.vue")
  },
  //我的
  {
    path:"/MyFun",
    name:'MyFun',
    //路由懒加载
    component:()=>import("../views/MyFun.vue")
  },
  //课堂
  {
    path:"/ClassroomFun",
    name:'ClassroomFun',
    //路由懒加载
    component:()=>import("../views/ClassroomFun.vue")
  },
  //手记评论详情
  {
    path:"/ReviewList",
    name:'ReviewList',
    //路由懒加载
    component:()=>import("../views/ReviewList.vue"),
    meta:{
      conceal :true
    }
  },
]
// 解决router重复点击报错的问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location){
  return originalPush.call(this,location).catch(err=>err);
}

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
